package com.xiaoshuidi.cloud.module.rooms.mapper;

import com.xiaoshuidi.cloud.framework.mybatis.core.mapper.BaseMapperX;
import com.xiaoshuidi.cloud.module.rooms.pojo.RoomReceipt;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface RoomReceiptMapper extends BaseMapperX<RoomReceipt> {
    @Select("select " +
            "       case " +
            "           when rh.is_concentrated = 1 then concat(rh.area, rh.building_no, '栋', rh.name) " +
            "           else concat(rh.area, rh.building_no, '栋', rh.unit_no, '单元', rh.name) " +
            "           end                  roomHouse " +
            "from room_house_reserve rhr " +
            "         left join room_house rh on rhr.room_house_id = rh.id " +
            "where rhr.id = #{id}" +
            "limit 1 ")
    String getRoomNameAll(@Param("id") Long id);
}
